export const getters = {
    carList(state) {
        return state.carList
    },
    allChecked(state) {
        if (state.carList.length > 0) {
            let hasFail = state.carList.find(item => item.checked == false)
            if (hasFail) {
                return false
            }
            return true
        } else {
            return false
        }
    },
    allPrice(state) {
        return 100 * (state.carList.filter(item => item.checked == true).reduce((acc, cur) => { return acc + Number(cur.newPrice) * cur.count }, 0.00))
    }
}